
#include "stdafx.h"

TEST(listenTest, listen_in_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "listen");
    listen_in_inout listenIN(sock, SOMAXCONN);
    listen_in_inout listenOUT;

    std::vector<char> buffer;
    Serialize(header, listenIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(listenOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (listenIN.s_, listenOUT.s_);
    EXPECT_EQ (listenIN.backlog_, listenOUT.backlog_);
}

//TEST(listenTest, listen_in_inout_NULL_parameters)
//{
//    
//}

TEST(listenTest, listen_out_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "listen");
    listen_out_inout listenIN(7);
    listen_out_inout listenOUT;

    std::vector<char> buffer;
    Serialize(header, listenIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(listenOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (listenIN.wsa_last_error_, listenOUT.wsa_last_error_);
}

//TEST(listenTest, listen_out_inout_NULL_parameters)
//{
//    
//}